<?php
	include_once("./config.php");
	$id = $_GET['id'];
	$pic_id = $_GET['pic_id'];
	$imgdel = $_GET['img'];   
	if($pic_id==1)
	{
		$img = "img1=''";
	}else if($pic_id==2){
		$img = "img2=''";
	}else if($pic_id==3){
		$img = "img3=''";
	}else if($pic_id==4){
		$img = "img4=''";
	}else if($pic_id==5){
		$img = "img5=''";
	}else if($pic_id==6){
		$img = "img6=''";
	}else if($pic_id==7){
		$img = "img7=''";
	}else if($pic_id==8){
		$img = "img8=''";
	}else if($pic_id==9){
		$img = "img9=''";
	}else if($pic_id==10){
		$img = "img10=''";
	}else if($pic_id==11){
		$img = "img11=''";
	}else if($pic_id==12){
		$img = "img12=''";
	}
	
	$imgdel2 = explode('.',$imgdel);	
	$count1 = count($imgdel2)-1;
	$czm = $imgdel2[$count1];

	$imgname = explode('_',$imgdel);
	$imgname = $imgname[1];

	$url2 = "../../upload/house/".$id."/".$pic_id.'_'.$imgname.'.'.$czm;
	$url = "../../upload/house/".$id."/".$imgdel;
	@unlink($url);
	@unlink($url2);
	$update = "update $TBL_HOUSE SET ".$img." where id=$id";
	mysql_query($update);
	MyNotice("圖片刪除成功", 1,'');
	exit(0);
?>